package game;

import java.util.Random;

class SceneManager
{
    static public SCENE currentScene;
    static public Scene scene = null;
    //static public int faseAberta = 0;
    static Random rand = new Random();
    public static int level = 0;
    public static int levelOld = 0;
    
	static int getLevel()
	{
		return level;
	}

	static public void setup()
	{
		//SoundClip.getInstance().LoadSongs();
		Audios.getInstance().loadSongs();
		LoadImages.getInstance().Load();
		SceneManager.scene = new LoaderFile();
		SceneManager.currentScene = SCENE.SCN_OPENING;
		
	}

	static public void changeScene(int currentScene)
	{
		Audios.getInstance().stopAll();
		
		switch (currentScene)
		{
			case 0:
				SceneManager.scene = new Menu();
				SceneManager.currentScene = SCENE.SCN_MENU;
				level = 0;
				break;
				
			case 1:
				level = 1;
				SceneManager.scene = new Level_01();
				SceneManager.currentScene = SCENE.SCN_LEVEL_01;
				break;
				
			case 2:

				level = 2;
				SceneManager.scene = new Level_02();
				SceneManager.currentScene = SCENE.SCN_LEVEL_02;
				break;
				
			case 3:
				level = 3;
				SceneManager.scene = new Level_03();
				SceneManager.currentScene = SCENE.SCN_LEVEL_03;				
				break;
				
			case 4:
				level = 4;
				SceneManager.scene = new Level_04();
				SceneManager.currentScene = SCENE.SCN_LEVEL_04;
				break;
				
			case 5:
				level = 5;
				SceneManager.scene = new Level_05();
				SceneManager.currentScene = SCENE.SCN_LEVEL_05;
				break;
				
			case 6:
				SceneManager.scene = new Instructions();
				SceneManager.currentScene = SCENE.SCN_MENU_INSTRUCTION;
				level = 0;
				break;
				
			case 7:
				SceneManager.scene = new Credits();
				SceneManager.currentScene = SCENE.SCN_MENU_CREDIT;
				level = 0;
				break;
				
		
			case 8:
				SceneManager.scene = new Opening();
				SceneManager.currentScene = SCENE.SCN_OPENING;
				level = 0;
				break;

			case 9:
				SceneManager.scene = new GameOver();
				SceneManager.currentScene = SCENE.SCN_GAMEOVER;
				break;
				
			case 10:
				SceneManager.scene = new NewLevel();
				SceneManager.currentScene = SCENE.SCN_NEWLVL;
				break;
				
			case 11:
				SceneManager.scene = new CompletedLevel();
				SceneManager.currentScene = SCENE.SCN_COMPLETEDLVL;
				break;
				
			case 12:
				SceneManager.scene = new Opening();
				SceneManager.currentScene = SCENE.SCN_OPENING;
				level = 0;
				break;
				
			case 13:
				SceneManager.scene = new Features();
				SceneManager.currentScene = SCENE.SCN_MENU_FEATURE;
				level = 0;
				break;
				
			case 14:
				SceneManager.scene = new NovoRecorde();
				SceneManager.currentScene = SCENE.SCN_NOVO_RECORDE;
				
				break;
				
			case 15:
				SceneManager.scene = new Recorde();
				SceneManager.currentScene = SCENE.SCN_MENU_RECORDE;
				break;
				
			case 16:
				SceneManager.scene = new Congrats();
				SceneManager.currentScene = SCENE.SCN_CONGRATS;
				level = 0;
				break;
		}
	}

	static public void newLevel()
	{
		switch(level)
		{
			case 0:
				level = 1;
				SceneManager.scene = new Level_01();
				SceneManager.currentScene = SCENE.SCN_LEVEL_01;
				break;
				
			case 1:
				level = 2;
				SceneManager.scene = new Level_02();
				SceneManager.currentScene = SCENE.SCN_LEVEL_02;
				break;
				
			case 2:
				level = 3;
				SceneManager.scene = new Level_03();
				SceneManager.currentScene = SCENE.SCN_LEVEL_03;				
				break;
				
			case 3:
				level = 4;
				SceneManager.scene = new Level_04();
				SceneManager.currentScene = SCENE.SCN_LEVEL_04;
				break;
				
			case 4:
				level = 5;
				SceneManager.scene = new Level_05();
				SceneManager.currentScene = SCENE.SCN_LEVEL_05;
				break;
		}
	}

	
	public static enum SCENE
	{
		SCN_OPENING,
		SCN_MENU,
		SCN_MENU_INSTRUCTION,
		SCN_MENU_CREDIT,
		SCN_MENU_FEATURE,
		SCN_MENU_RECORDE,
		SCN_GAMEOVER,
		SCN_NEWLVL,
		SCN_COMPLETEDLVL,
		SCN_LEVEL_INTRO,
		SCN_LEVEL_01,
		SCN_LEVEL_02,
		SCN_LEVEL_03,
		SCN_LEVEL_04,
		SCN_LEVEL_05,
		SCN_NOVO_RECORDE,
		SCN_CONGRATS,
	}
	
}
